public class Lc_JD2 {
    class Solution {
        public ListNode reverseList(ListNode head) {
            if(head == null) {
                return null;
            }
            ListNode cur = head.next;
            head.next = null;
            while(cur != null) {
                ListNode curN = cur.next;
                cur.next = head;
                head = cur;
                cur = curN;
            }
            return head;
        }
    }

    public static void main(String[] args) {

    }
}
